This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
note: I sent this to your email. Wanted to also post here in case this script could help someone else.
Thanks for your assistance on LDD. I'm not the world's greatest programmer but have experience with the Domino IDE (primarily core formula, LS, and JS). I created an agent that will run in the evenings after the DB2 table is updated. At this stage, it just removes all documents and rebuilds new ones. Fortunately, a DB2 table was built with the exact information required. We used to have to do joins <et al> with the old agent. Utopia would be not removing all documents. That said... this is where my knowledge begins to narrow. I would like to check for changes then just update existing documents or create new docs if there are new entries in DB2. Here is my current script:
note: my current point of confusion is the "Nothing" and keylist part. It always needs to create/use all documents in this table.
On Error Goto ErrorHandler
'Declare Notes Objects
Dim nsession As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim count As Long
Dim sqlstring As String
Dim olddoc As NotesDocument
Dim olddoc2 As NotesDocument
Dim storedoc As NotesDocument
'Delete Documents
Set view = db.GetView("Stores")
Set olddoc = view.GetFirstDocument
While Not (olddoc Is Nothing)
Set olddoc2 = olddoc
Set olddoc = view.GetNextDocument(olddoc)
Call olddoc2.RemovePermanently(True)
Wend
'Declare LC Objects
Dim Session As New LCSession
Dim src As LCConnection
Dim FieldOut As New LCFieldList
Dim KeyList As New LCFieldList
Dim FLDCustomerNumber As LCField
Dim FLDClass As LCField
Dim FLDSubClass As LCField
Dim FLDStoreName As LCField
Dim FLDAddress1 As LCField
Dim FLDAddress2 As LCField
Dim FLDAddress3 As LCField
Dim FLDAddress4 As LCField
Dim FLDCity As LCField
Dim FLDState As LCField
Dim FLDZip As LCField
Dim FLDPhone As LCField
Dim FLDEmail As LCField
Dim FLDWeb As LCField
Dim xtbfld As LCField
‘Establishing the Connection to XTTB
Session.ClearStatus
Set src = New LCConnection ("db2")
src.Database = "DbName"
src.Metadata = "SAMPLE.XTTB"
src.UserID ="yyy"
src.Password = "zzz"
Print "Establishing Connection to XTTB"
src.Connect
Print "Connection to XTTB established"
'Create key fieldlist (all records in XTTB)
Set wtbfld = Nothing
xtbfld.Flags = LCFIELDF_KEY
xtbfld.value = xtbkey(0)
'No key select since custom table
count = src.Select(Nothing,1,fieldout)
'Set LC Fields
Set FLDCustomerNumber = Fieldout.Lookup ("XTBCUSN")
Set FLDClass = Fieldout.Lookup ("XTBCSCL")
Set FLDSubClass = Fieldout.Lookup ("XTBCSSC")
Set FLDStoreName = Fieldout.Lookup ("XTBCSNM")
Set FLDAddress1 = Fieldout.Lookup ("XTBADD1")
Set FLDAddress2 = Fieldout.Lookup ("XTBADD2")
Set FLDAddress3 = Fieldout.Lookup ("XTBADD3")
Set FLDAddress4 = Fieldout.Lookup ("XTBADD4")
Set FLDCity = Fieldout.Lookup ("XTBCITY")
Set FLDState = Fieldout.Lookup ("XTBSTAT")
Set FLDZip = Fieldout.Lookup ("XTBZIP")
Set FLDPhone = Fieldout.Lookup ("XTBPHON")
Set FLDEmail = Fieldout.Lookup ("XTBEML")
Set FLDWeb = Fieldout.Lookup ("XTBWEBA")
If ( session.status <> LCSUCCESS) Then
Print session.GetstatusText, 0, _
+ "The following LC for DB2 error has occurred."
Else
Print Error$, 0, _
+ "The following LotusScript error has occurred."
End If
End Sub
Feedback response number WEBB7CVHL9 created by ~Sanjay Umtumisonikle on 03/19/2008